package com.gxa.common.utils;


import com.gxa.common.R;

public class ResultUtils {

    /**
     * 构建带分页的成功数据
     * @param data
     * @param count
     * @return
     */
    public static R buildSuccess(Object data, Long count){
        R result = new R();
        result.setCode(200);
        result.setMessage("请求成功！");
        result.setData(data);
        return result;
    }

    /**
     * 构建单个结果成功数据
     * @param obj
     * @return
     */
    public static R buildSuccess(Object obj){
        return buildSuccess(obj,null);
    }

    /**
     * 不带返回数据的成功消息
     * @return
     */
    public static R buildSuccess(){
        return buildSuccess(null);
    }

    public static R buildFail(Integer code, String msg){
        R result=new R();
        result.setCode(code);
        result.setMessage(msg);
        return result;
    }

}
